import { axios } from "@/utils/request";
import { baseUrl } from "@/services/baseUrl";
import qs from "qs";
//查询所有项目下拉框
export function getAllProListByQX(params) {
  return axios({
    url: baseUrl + "/mdata/sysProject/getProListByQX",
    method: "GET",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    params,
  });
}

//根据项目查询标段 tenantCode   type 类型   1所有 2建设 3施工+监理 4施工 5监理
export function getAllQxSecs(params) {
  return axios({
    url: baseUrl + "/probusiness/sysOrg/getAllQxSecs",
    method: "GET",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    params,
  });
}

//字典表查询
export function getDicItemByCode(data) {
  return axios({
    url: baseUrl + "/system/dicSet/getDicItemByCode",
    method: "POST",
    data: qs.stringify(data),
  });
}

//查询项目树
export function getProListTreeByQX(params) {
  return axios({
    url: baseUrl + "/mdata/sysProject/getProListTreeByQX",
    method: "GET",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    params,
  });
}

//查询岗位
export function getPositionList(params) {
  return axios({
    url: baseUrl + `/mdata/sysPosition/getPositionByProAndOrg`,
    method: "GET",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    params,
  });
}

//查询有权限的人员
export function getOrgUserList(params) {
  return axios({
    url: baseUrl + `/probusiness/sysUser/getOrgUsers`,
    method: "GET",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    params,
  });
}

//看板级-项目列表
export function getProjectByParentCode(data) {
  let { parentCode = "lianyungang" } = data;
  return axios({
    url:
      baseUrl +
      `/mdata/sysProject/getProjectByParentCode?parentCode=${parentCode}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//根据项目查询人员
export function getProjectByUser(data) {
  let { proCode } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/bimMarkMain/getTreeOrganizationAndUserDataByOrgCode?orgCode=${proCode}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
}

export function getMenuSelect() {
  return axios({
    url: baseUrl + `/system/menu/getMenuAllDataSelect`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
}
